package com.example.leetdemo.finash;

public class Solution6201 {

    public int[] findArray(int[] pref) {
        if (pref == null || pref.length == 0) {
            return new int[0];
        }
        int[] dp = new int[pref.length];
        int[] dp2 = new int[pref.length];
        dp[0] = pref[0]; dp2[0] = dp[0];
        for (int i = 1; i < pref.length; i++) {
            dp[i] = dp2[i - 1] ^ pref[i];
            dp2[i] = dp2[i - 1] ^ dp[i];
        }
        return dp;
    }

    public static void main(String[] args) {
        Solution6201 solution6201 = new Solution6201();
        int[] ints = solution6201.findArray(new int[] {5,2,0,3,1});
        System.err.println();
        System.err.println(5 ^ 2);
        System.err.println(7 ^ 2);
    }
}
